#include <iostream>

using namespace std;

int main() {
    int arr[] = {9,3,5,7,2,1,10,4,6,8};
    int arrLength = sizeof(arr)/sizeof(arr[0]);
    for (int i = 0; i < arrLength-1; ++i) {  //控制循环次数，length-1次循环
        for (int j = 0; j < arrLength-1-i; ++j) {
            if(arr[j] > arr[j+1]){
                int temp = arr[j];
                arr[j] = arr[j+1];
                arr[j+1] = temp;
            }
        }
    }

    for (int i = 0; i < arrLength; ++i) {
        cout << i << " = " << arr[i] << endl;
    }
    return 0;
}
